@model IEnumerable<ProjectCodeS.Models.Client>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th></th>
        <th>
            FirstName
        </th>
        <th>
            LastName
        </th>
        <th>
            Phone
        </th>
        <th>
            Created
        </th>
        <th>
            LastEdited
        </th>
        <th>
            LastAccessed
        </th>
        <th>
            Store
        </th>
        <th>
            Tickets
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.Id }) |
            @Html.ActionLink("Details", "Details", new { id=item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.Id })
        </td>
        <td>
			@item.FirstName
        </td>
        <td>
			@item.LastName
        </td>
        <td>
			@item.Phone
        </td>
        <td>
			@String.Format("{0:g}", item.Created)
        </td>
        <td>
			@String.Format("{0:g}", item.LastEdited)
        </td>
        <td>
			@String.Format("{0:g}", item.LastAccessed)
        </td>
        <td>
			@(item.Store == null ? "None" : item.Store.Name)
        </td>
        <td>
			@(item.Tickets == null ? "None" : item.Tickets.Count.ToString())
        </td>
    </tr>
}

</table>


